package com.ar4j.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Defines a custom type conversion between an active record's field type (object representation)
 * and the storage type (type to send to backing store).
 */
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Type {
  
  /**
   * @return class of the converter that is able to convert the marked field's object representation into its 
   * storage representation 
   */
  Class<?> converterClass();
  
  /**
   * Optional, should be used to tell the converter what its object representation type is
   */
  Class<?> objectType() default Type.class;
  
  /**
   * Optional, should be used to tell the converter what its storage representation type is
   */
  Class<?> storageType() default Type.class;
  
}
